﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Mail;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace KaraKulak
{
    public partial class Contact : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void btngonder_Click(object sender, EventArgs e)
        {
            try
            {
                MailMessage mail = new MailMessage();
                mail.To.Add("iletişim@karakulakdogalkaynaksuyu.com");
                mail.From = new MailAddress(txtemail.Text);
                mail.Subject = txtmessage.Text;
                mail.IsBodyHtml = true;
                mail.Body = "<table><tr><td>Ad :</td><td>" + txtisim.Text + "</td></tr><tr><td>Email :</td><td>" + txtemail.Text + "</td></tr><tr><td>Mesaj : </td><td>" + txtmessage.Text + "</td></tr></table>";

                SmtpClient client = new SmtpClient();
                client.Host = "iletişim@karakulakdogalkaynaksuyu.com";
                client.Send(mail);

                Response.Write("<script language='javascript'>alert('Mesajınız Başarıyla İletildi!');</script>");
            }

            catch
            {
                Response.Write("<script language='javascript'>alert('Bir Hata Oluştu!');</script>");
            }


        }
    }
}